package edu.stanford.jgc.GeocoderWrapper;

import java.io.IOException;
import java.util.List;

import android.content.Context;
import android.location.Address;
import android.location.Geocoder;


public class GeocoderWrapper {
	Geocoder coder;
	
	public GeocoderWrapper(Geocoder coder) {
		this.coder = coder;;
	}

	public Address geocode(String address) {
		try {
			List<Address> addressList = coder.getFromLocationName(address, 1);
			if (addressList.size() == 0){
				return null;
			} else {
				return addressList.get(0);
			}
		} catch (IOException e) {
			System.err.println("Error: "+e.getMessage());
			return null;
		}
	}
	
}
